#!/usr/bin/env python
# encoding: utf-8
# @author: Lin Han
# @contact: voldemort22@126.com
# @file: configs.py
# @time: 2021/3/29 10:58
# @desc:
import pika

NUMBER_HISTORY_CLAMP_START = 2021010000000001
NUMBER_HISTORY_PART_START = 2021020000000001
NUMBER_STANDARD_CLAMP_START = 2021030000000001
NUMBER_STANDARD_PART_START = 2021040000000001
NUMBER_PARAMETER_MODEL_START = 2021050000000001
NUMBER_SCENE_START = 2021060000000001
BACKEND_IP = "139.196.5.247"
BACKEND_PORT = 18000

# message queue
MQ_IP = BACKEND_IP
MQ_PORT = 5672
MQ_ACCOUNT = "admin"
MQ_PASSWORD = "rabbitmq666"
DEFAULT_QUEUE = "new_transfer"

# MONGO_IP = BACKEND_IP
MONGO_IP = "161.189.75.127"
MONGO_PORT = 27017
MONGO_ACCOUNT = "linhan"
MONGO_PASSWORD = "linhan1987"
MONGO_URL = f'mongodb://{MONGO_ACCOUNT}:{MONGO_PASSWORD}@{MONGO_IP}:{MONGO_PORT}/'
MONGO_DATABASE_NAME = "do_center"

HISTORY_CLAMP_COLLECTION = "history_clamp"
HISTORY_PART_COLLECTION = "history_part"
STANDARD_CLAMP_COLLECTION = "standard_clamp"
STANDARD_PART_COLLECTION = "standard_part"
PARAMETER_MODEL_COLLECTION = "parameter_model"
SCENE_COLLECTION = "scene"
FACTORY_STANDARD_COLLECTION = "factory_standard"
USER_COLLECTION = "user"
CONFIG_COLLECTION = "config"
PART_TYPE_COLLECTION = "part_type"

RELATION_01_03_COLLECTION = "01_03_relation"
RELATION_02_04_COLLECTION = "02_04_relation"
RELATION_02_05_COLLECTION = "02_05_relation"
RELATION_04_05_COLLECTION = "04_05_relation"

credentials = pika.PlainCredentials(MQ_ACCOUNT, MQ_PASSWORD)
parameters = pika.ConnectionParameters(
    MQ_IP,
    MQ_PORT,
    "/",
    credentials=credentials,
    heartbeat=0,
)
# connection = pika.BlockingConnection(parameters)
# channel = connection.channel()

# AliOss相关的一系列常量
CATPART_OSS_ADDRESS = "catpartAliOssAddress"
STP_OSS_ADDRESS = "stpAliOssAddress"
STL_OSS_ADDRESS = "stlAliOssAddress"
GLTF_OSS_ADDRESS = "gltfAliOssAddress"
JSON_OSS_ADDRESS = "jsonAliOssAddress"

WORKPIECE_CATPART_OSS_ADDRESS = "workpieceCatpartAliOssAddress"
WORKPIECE_STP_OSS_ADDRESS = "workpieceStpAliOssAddress"
WORKPIECE_STL_OSS_ADDRESS = "workpieceStlAliOssAddress"
WORKPIECE_GLTF_OSS_ADDRESS = "workpieceGltfAliOssAddress"

CONFIG_DATA_HISTORY_CLAMP_TYPE = "historyClamp"
CONFIG_DATA_HISTORY_PART_TYPE = "historyPart"
CONFIG_DATA_STANDARD_CLAMP_TYPE = "standardClamp"
CONFIG_DATA_STANDARD_PART_TYPE = "standardPart"
CONFIG_DATA_PARAMETER_MODEL_TYPE = "parameterModel"
CONFIG_DATA = "configData"

# REDIS相关信息
REDIS_IP = BACKEND_IP
REDIS_PORT = 6379

HISTORY_CLAMP_REDIS_PORT = 10001
HISTORY_PART_REDIS_PORT = 10002
STANDARD_CLAMP_REDIS_PORT = 10003
STANDARD_PART_REDIS_PORT = 10004
PARAMETER_MODEL_REDIS_PORT = 10005
SCENE_REDIS_PORT = 10006

PART_TYPE_REDIS_PORT = 10010
